// custom-tab-bar/index.ts
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    selected: Number,
  },

  /**
   * 组件的初始数据
   */
  data: {
    listTab: [
      {
        pagePath: "/pages/index/index",
        text: "首页",
        iconPath: "/image/tabbar/home.png",
        selectedIconPath: "/image/tabbar/home2.png",
      },
      {
        text: "消息",
        iconPath: "/image/tabbar/xx.png",
        selectedIconPath: "/image/tabbar/xx2.png",
      },
      {
        pagePath: "/pages/notice/notice",
        text: "公告",
        iconPath: "/image/tabbar/gg.png",
        selectedIconPath: "/image/tabbar/gg2.png",
      },
      {
        pagePath: "/pages/my/my",
        text: "我的",
        iconPath: "/image/tabbar/my.png",
        selectedIconPath: "/image/tabbar/my2.png",
      },
    ],
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e: any) {
      const { path, index } = e.currentTarget.dataset;
      if (index !== 1) {
        wx.switchTab({ url: path });
      }
    },
  },
});
